import request from '/@/utils/request';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 用户列表api接口集合
 */
export function useRoleApi() {
    return {
        getRole: (params?: object) => {
            return request({
                url: '/lxs/saas/power/role/get_role_list',
                method: 'get',
                params,
            });
        },
        getRoleSelect: (params?: object) => {
            return request({
                url: '/lxs/saas/power/role/get_permission_list',
                method: 'post',
                params,
            });
        },
        addRole: (params?: object) => {
            return request({
                url: '/lxs/saas/power/role/role_form_add',
                method: 'post',
                data: params,
            });
        },
        editRole: (params?: object) => {
            return request({
                url: '/lxs/saas/power/role/role_form_edit',
                method: 'post',
                data: params,
            });
        },
        editPermission: (params?: object) => {
            return request({
                url: '/lxs/saas/power/role/set_permission_submit',
                method: 'post',
                data: params,
            });
        },
        deleteRole: (params?: object) => {
            return request({
                url: '/lxs/saas/power/role/delete_role_submit',
                method: 'post',
                data: params,
            });
        },
    };
}
